POV-Ray : Newsgroups : povray.programming : Improved intersection routine for CSG-Intersection objects : Re: Improved intersection routine for CSG-Intersection objects Server Time
6 Oct 2024 20:19:34 EDT (-0400)
  Re: Improved intersection routine for CSG-Intersection objects  
From: Wolfgang Wieser
Date: 14 Dec 2003 19:05:43
Message: <3fdcfad6@news.povray.org>
Thorsten Froehlich wrote:

> In article <3fdcbcc2@news.povray.org> , Wolfgang Wieser <wwi### [at] gmxde>
> wrote:
> 
>> I just have to emphasize the statement "if and only if used properly".
>> Usind RTTI and exceptions, it is easy to get a really fat (as of binary
>> size) and slow program much faster than you think.
> 
> No, not at all!  RTTI is something you get for no runtime cost at all and
> the data size it adds is in the range of a few dozen bytes per class.  If
> you can get exceptions for free depends a tiny bit on the architecture
> used,
> but in general the answer is yes as well.  In particular, if you don't
> throw any exceptions inside a function, exceptions will not cost anything.
> 
> The frequently found warning that RTTI and exceptions make programs slow
> is due to very early C++ compilers (we are talking about ten years old or
> more)
> did not implement these features efficently.  This is not the case for
> *any* recent compiler released in the past few years.
> 
I said "slow & fat". 

If exceptions are slower than normal return, that won't hurt much 
because they are meant to be used as "exceptions". So, for exceptions 
my critisism was the size overhead. 

And for RTTI: I cannot imagine that a dynamic_cast has real little 
overhead but I honestly hope that it is the case until I run a test 
in the next days. 

Okay, my observations quoted above were based on my experiences on the 
gcc-2.7.3.2 -> gcc-2.8 transition and may very well be outdated. 

So, I tried again using
gcc (GCC) 3.3.3 20031129 (prerelease)

"Normal compile" means that I compiled with -Os which is -O2 plus 
some minor size optimisations. For the other compile, I used 
-Os -fno-rtti -fno-exceptions. 

I tested RendView, POVRay-3.50c (with PRT patch) and another 
program which uses lots of dynamic alloc and ref counting (AniVision). 
All of these programs neither use RTTI nor exceptions: 

This table compares stripped binary size. 
                             RendView  POVRay  AniVision
Normal compile:               525780   960092   826900
Exceptions and RTTI disabled: 421764   898492   593476
Overhead:                     ca 20%   ca 10%   ca 40%

So, RTTI and exceptions still introduce considerable overhead even if 
not used. I'm not sure which of the two features is to blame for the 
increase and I won't test now because it's too late at night...
(While I would tolerate 10%, I don't want to live with the 40% 
unnecessary code for AniVision.) 

These were just my observations for the impact of disabling exceptions 
and RTTI _when_not_being_used_ in the program. The impact when using 
them is more interesting, however. I'll do some test later (it's too 
late night now). 

Wolfgang


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.